<template>
  <van-swipe class="my-swipe" :autoplay="3000" indicator-color="#b0bfc6">
    <van-swipe-item>
      <img class="bannerimg" :src="bannersrc" alt="" />
    </van-swipe-item>
    <van-swipe-item>
      <img class="bannerimg" :src="bannersrc" alt="" />
    </van-swipe-item>
    <van-swipe-item>
      <img class="bannerimg" :src="bannersrc" alt="" />
    </van-swipe-item>
    <van-swipe-item>
      <img class="bannerimg" :src="bannersrc" alt="" />
    </van-swipe-item>
    {{obj}}
  </van-swipe>
</template>

<script>
export default {
  data() {
    return {
      bannersrc: '',
    };
  },
  computed: {
    obj() {
      if (this.$store.state.Home.list.length != 0) {
        this.$store.state.Home.list.forEach((v) => {
          if (v.id == this.idkey) {
            this.bannersrc=v.src
            return v.src;
          }
        });
        return null;
      } else {
        return null;
      }
    }
  },
  props:['idkey'],
};
</script>

<style scoped>
.bannerimg {
  height: 270rem;
  width: 100%;
}
</style>
